// 创建一个路由器，并暴露出去
// 第一步：引入createRouter
import {createRouter, createWebHistory} from 'vue-router'
// 引入一个一个可能要呈现组件
import Index from '@/views/Index.vue'
import Login from '@/views/admin/Login.vue'
import Admin from '@/views/admin/Admin.vue'
import Role from '@/views/admin/Role.vue'
import Permission from '@/views/admin/Permission.vue'
import Category from '@/views/product/Category.vue'
import Product from '@/views/product/Product.vue'

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: [
        {path: '/login', component: Login},
        {
            path: '/', component: Index, children: [
                {path: '/admin', component: Admin},
                {path: '/role', component: Role},
                {path: '/permission', component: Permission},
                {path: '/category', component: Category},
                {path: '/product', component: Product}
            ]
        }
    ]
})

// 暴露出去router
export default router
